package com.wenlin.page.response;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/***
 *  Created with IntelliJ IDEA.
 *  User:  wenlin
 *  Date:  2017-11-023
 *  Time: 14:40
 *  Description:数据封装类
 **/

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Message<T> implements Serializable {

  @ApiModelProperty(value = "消息", required = true)
  @JsonProperty("msg")
  private String msg = "success";

  @ApiModelProperty(value = "状态码", required = true)
  @JsonProperty("code")
  private int code = 0;

  @ApiModelProperty(value = "数据", required = true)
  @JsonProperty("data")
  private T data;

  public Message() {
  }

  public Message(T data) {
    this.data = data;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  public T getData() {
    return data;
  }

  public void setData(T data) {
    this.data = data;
  }

  @Override public String toString() {
    return "Message{" +
        "msg='" + msg + '\'' +
        ", code=" + code +
        ", data=" + data +
        '}';
  }
}